<template>
  <div>
    <h3>Left组件{{ age }}</h3>
    <p>这是left组件，做一个输入框和按钮互斥的效果</p>
    <input ref="ipt" type="text" v-if="flag" @blur="flag=false">
    <button v-else @click="showIpt">按钮</button>
  </div>
</template>

<script>
export default {
  data () {
    return {
      flag: true,
      age: 20
    }
  },
  methods: {
    showIpt () {
      this.age++
      this.age++
      this.flag = true
      this.$nextTick(() => {
        this.$refs.ipt.focus() 
      })
    }
  }
}
</script>

<style lang="less" scoped>
h3 {
  color:blueviolet;
}
</style>